
import AdManager, { Platform } from "../../../Platforms/AdManager";
import { FormType } from "../../../UIFrame/config/SysDefine";
import UIBase from "../../../UIFrame/UIBase";

const { ccclass, property } = cc._decorator;

@ccclass
export default class BaiduAdUI extends UIBase {

    formType = FormType.PopUp;

    static prefabPath = "prefabs/UIForms/adUI/BaiduAdUI";

    onShow() {

        AdManager.getInstance().platform = Platform.baidu_H5;
        AdManager.getInstance().onInit(() => { });
    }

    onLoad() {
    }

    start() {

    }

    async showAnimation() {
        console.log('重写打开动画');
    }

    onClickEvent_openBanner() {
        AdManager.getInstance().showBanner('banner');
    }

    onClickEvent_openVideo() {
        AdManager.getInstance().showVideo('video', () => {
            console.log('成功回调');
        }, () => {
            console.log('失败回调');
        });
    }

    onClickEvent_share() {
        AdManager.getInstance().onShare((res) => {
            if(res ==1){
                console.log('分享==>成功');
            }else if(res == 0){
                console.log('分享==>失败');
            }
        });
    }

    onHide() {

    }
}
